package com.crimerank.data;

import java.io.Serializable;

public class StopCrime extends Stop implements Serializable {

	private static final long serialVersionUID = 6098923551529548809L;
	private String crimeAggregate;
	private int total;
	private double distance;
	boolean isRail;
	
	public void setCrimeAggregate(String crimeAggregate) {
		this.crimeAggregate = crimeAggregate;
	}
	
	public String getCrimeAggregate() {
		return crimeAggregate;
	}
	
	public void setTotal(int total) {
		this.total = total;
	}
	
	public int getTotal() {
		return total;
	}

	public void setDistance(double distance) {
		this.distance = distance;
	}

	public double getDistance() {
		return distance;
	}
	

	public boolean isRail() {
		return isRail;
	}

	public void setRail(boolean isRail) {
		this.isRail = isRail;
	}

	public String getRank(){
		double density = 0;
		String rank = "NA";
		if(total == 0){
			return "NA";
		}
		if(isRail){
			density = (double)total / (Math.PI * 0.75 * 0.75);
			if(density > 218){
				rank = "High";
			}else if(density > 30){
				rank = "Avg";
			}else{
				rank = "Low";
			}
		}else{
			density = (double)total / (Math.PI * 0.50 * 0.50);
			if(density > 90){
				rank = "High";
			}else if(density > 40){
				rank = "Avg";
			}else{
				rank = "Low";
			}
		}
		
		return rank;
	}
}
